
package com.googlecode.mvndroid;

import com.googlecode.mvndroid.tools.AdbTool;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

/**
 * @goal uninstall
 * @description Uninstall the package from the default emulator.
 *
 * @author <a href="mailto:1.024e3@gmail.com">Bartosz Duzy</a>
 */

public class Adb_uninstallMojo extends AndroidMojo{

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {

        ProcessBuilder processBuilder = new ProcessBuilder();
        AdbTool tool = new AdbTool(this);
        List<String> parameters = new ArrayList<String>();

        parameters.add("uninstall");

        if(isGenerateUnsignedPackage()){
            parameters.add(getOutUnsignedPackage().getAbsolutePath());
        }else{
            parameters.add(getOutDebugPackage().getAbsolutePath());
        } 

        tool.setParameters(parameters);

        tool.execute(processBuilder);
     
    }

}
